package com.mavet.demo.jdbcdemo1;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class AppUpdate {

	public static void main(String[] args) {
		
		String url = "jdbc:mysql://localhost:3306/jdbcdemo";
		String username = "root";
		String password = "soft";
		Connection conn = null;
		try {
			Class.forName("com.mysql.jdbc.Driver");
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}

		try {
			conn = DriverManager.getConnection(url, username, password);
			PreparedStatement ps = null;

			String sql = "update user set name=?,password=? where id=?";
			ps = conn.prepareStatement(sql);
			ps.setString(1, "wen3");
			ps.setString(2, "wen3");
			ps.setInt(3, 10);
			ps.execute();


		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

}
